<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="UTF-8">
        <%@ include file="/WEB-INF/views/include/head.jsp"%> 
        <link rel="stylesheet" href="${ctxStatic}/css/layerSm.css">
        <script src="${ctxStatic}/jquery-barcode/jquery-barcode.js" type="text/javascript"></script>
        <style>
            .data{
                margin-bottom:6px;
            }
        </style>
        <script>
            var windowH = window.innerHeight
                            ||document.documentElement.clientHeight
                            ||document.body.clientHeight
                    $('.middle').css('height',windowH - 40);
            
            $(document).ready(function(){
                $("#materialBarCodeDiv").empty().barcode($("#materialBarCode").val(), "code128",{barWidth:2, barHeight:30,showHRI:false});
               });
            //删除
            function delMyMaterial(){
                // 调用后台删除方法
                $.post("${ctx}/material/mymaterial/delete?id=${myMaterial.id}",'',function(result){
                    // 删除提示信息
                    tipParent(result.message);
                    // 返回结果
                    if(result.statusCode==STATUSCODEOK){
                        // 刷新页面
                        window.parent.frames[0].location.reload();
                        // 关闭页面
                        closeWin(); 
                     }
                },'json');
           }
        </script>
    </head>
    <body>
        <!--头部-->
        <div class="myshop clearfix">
            <!-- 查看物料 -->
            <p class="myshoptop fl"><spring:message code="myMaterial_showMaterial"/></p>
            <div class="fr">
                <shiro:hasPermission name="material:mymaterial:edit">
                    <!-- 编辑 -->
                    <div class="topBtn" onclick="popup('935px','550px','${ctx}/material/mymaterial/form?id=${myMaterial.id}');closeWin()">
                        <img src="${ctxStatic}/images/btn-bj.png">
                    </div>
                    <!-- 删除 -->
                    <div class="topBtn" onclick="del(delMyMaterial)">
                        <img src="${ctxStatic}/images/btn-sc.png">
                    </div>
                </shiro:hasPermission>
                <!-- 关闭 -->
                <div class="topBtnClose" onclick="closeWin()">
                    <img src="${ctxStatic}/images/btn-close.png">
                </div>
            </div>
        </div>
        <div class="myshop_middle">
            <div class="data clearfix">
                <div class="ch fl clearfix">
                    <!-- 物料编码 -->
                    <p class="data_id_list"><spring:message code="myMaterial_showMateial_code"/></p>
                    <p class="rtname fl">${myMaterial.materialCode}</p>
                </div>
                <div class="ch fr">
                    <!-- 业务类别 -->
                    <p class="data_id_list"><spring:message code="myMaterial_showMateial_businessType"/></p>
                    <p class="rtname fl">${fns:getDictName(myMaterial.materialUseType)}</p>
                </div>
            </div>
            <div class="data clearfix">
                <div class="ch fl">
                    <!-- 物料类别 -->
                    <p class="data_id_list"><spring:message code="myMaterial_showMateial_materialType"/></p>
                    <p class="rtname fl" data-toggle="tooltip" title="${fns:getDictName(myMaterial.materialTypeCd)}">${fns:getDictName(myMaterial.materialTypeCd)}</p>
                </div>
            </div>
            <div class="data clearfix">
                <div class="ch fl">
                    <!-- 物料条形码 -->
                    <p class="data_id_list"><spring:message code="myMaterial_showMateial_barCode"/></p>
                    <div class="fl txmBox" id="materialBarCodeDiv" ></div>
                    <input type="hidden" id="materialBarCode" name="materialBarCode" value="${myMaterial.materialBarCode}"> 
                </div>
                <div class="ch fr">
                    <!-- 物料材质 -->
                    <p class="data_id_list"><spring:message code="myMaterial_showMateial_texture"/></p>
                    <p class="rtname fl"  data-toggle="tooltip" title="${myMaterial.materialComposition}">${myMaterial.materialComposition}</p>
                </div>
            </div>
            <div class="data clearfix">
                <div class="ch fl">
                    <!-- 中文名称 -->
                    <p class="data_id_list"><spring:message code="myMaterial_showMateial_nameCn"/></p>
                    <p class="rtname fl"  data-toggle="tooltip" title="${myMaterial.materialNameCn}">${myMaterial.materialNameCn}</p>
                </div>
                <div class="ch fr">
                    <!-- 英文名称 -->
                    <p class="data_id_list"><spring:message code="myMaterial_showMateial_nameEn"/></p>
                    <p class="rtname fl"  data-toggle="tooltip" title="${myMaterial.materialNameEn}">${myMaterial.materialNameEn}</p>
                </div>
            </div>
            <div class="data clearfix">
                <div class="ch fl">
                    <!-- 物料规格 -->
                    <p class="data_id_list"><spring:message code="myMaterial_showMateial_spec"/></p>
                    <p class="rtname fl" data-toggle="tooltip" title="${myMaterial.materialSpec}">${myMaterial.materialSpec}</p>
                </div>
                <div class="ch fr">
                    <!-- 物料单位 -->
                    <div class="clearfix">
                        <p class="data_id_list"><spring:message code="myMaterial_showMateial_unit"/></p>
                        <p class="rtname fl">${fns:getDictName(myMaterial.materialUnitCd)}</p>
                    </div>
                    <!-- 物料等级 -->
                    <div class="clearfix">
                        <p class="data_id_list"><spring:message code="myMaterial_showMateial_materialLevel"/></p>
                        <p class="rtname fl">${fns:getDictName(myMaterial.materialLevel)}</p>
                    </div>
                </div>
            </div>
            <div class="data clearfix">
                <div class="ch fl clearfix">
                    
                    <!-- 物料款式 -->
                    <div class="data clearfix">
                        <p class="data_id_list"><spring:message code="myMaterial_showMateial_style"/></p>
                        <p class="rtname fl">
                            <c:forEach items="${fn:split(myMaterial.materialStyleCategory,',')}" var="selectStyle" >
                              ${fns:getDictName(selectStyle)}
                            </c:forEach>
                        </p>
                    </div>
                    <div class="data clearfix">
                        <!-- 物料季节 -->
                        <p class="data_id_list"><spring:message code="myMaterial_showMateial_season"/></p>
                        <p class="rtname fl">${myMaterial.materialYear}${fns:getDictName(myMaterial.materialSeason)}</p>
                    </div>
                    <div class="data clearfix">
                        <!-- 物料颜色 -->
                        <p class="data_id_list"><spring:message code="myMaterial_showMateial_color"/></p>
                        <p class="rtname fl" data-toggle="tooltip" title="${myMaterial.materialColor}">${myMaterial.materialColor}</p>
                    </div>
                    <div class="data clearfix">
                        <!-- 描述 -->
                        <p class="data_id_list"><spring:message code="myMaterial_showMateial_remarks"/></p>
                        <p class="rtname fl" data-toggle="tooltip" title="${myMaterial.remarks}">${myMaterial.remarks}</p>
                    </div>
                </div>
                <div class="ch fr clearfix">
                    <!-- 物料克重-->
                    <div class="data clearfix">
                        <p class="data_id_list "><spring:message code="myMaterial_showMateial_materialGramWeight"/></p>
                        <p class="rtname fl" data-toggle="tooltip" title="<fmt:formatNumber value="${myMaterial.materialGramWeight}" pattern="#,#00.00#"/>"><fmt:formatNumber value="${myMaterial.materialGramWeight}" pattern="#,#00.00#"/></p>
                    </div>
                    <div class="data clearfix">
                    <!-- 物料部位 -->
                        <p class="data_id_list "><spring:message code="myMaterial_showMateial_placement"/></p>
                        <p class="rtname fl">
                         <c:forEach items="${fn:split(myMaterial.materialPlacement,',')}" var="selectPlacement" >
                              ${fns:getDictName(selectPlacement)}
                            </c:forEach>
                        </p>
                    </div>
                    <div class="ch_top clearfix">
                        <!-- 照片 -->
                        <p class="data_id"><spring:message code="myMaterial_pic"/></p>
                        <div class="square" style="height:142px;">
                            <c:if test="${not empty myMaterial.uploadFile.showImgUrl}">
                               <img src="${myMaterial.uploadFile.showImgUrl}" width='140' height='140' class="tableImg">
                               <img src="${myMaterial.uploadFile.showImgUrl}" width='140' height='140' class="posImg posImg2">
                            </c:if>
                            <c:if test="${empty myMaterial.uploadFile.showImgUrl}">
                               <img src="${ctxStatic}/images/pic-none.jpg" width='140' height='140'>
                            </c:if>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <script src="${ctxStatic}/layer/layerStyle.js"></script>
        <script>
        $(".tableImg").hover(function(){
            var thisImg = $(this).next('.posImg2');
            var thisW = $(this).width();
            var thisH = $(this).height();
            thisImg.css({
                width:thisW*2 + "px",
                height:thisH*2 + "px"
            });
            var thisImgW = thisImg.width();
            var thisImgH = thisImg.height();
            var thisImgTop = $(this).offset().top;
            var thisImgLeft = $(this).offset().left;
            thisImg.css({
                top:thisImgTop - (thisImgH - thisH)/2 + "px",
                left:thisImgLeft - (thisImgW - thisW)/2 + "px",
            })
            
            thisImg.show()
        });

        $(".posImg2").hover(function(){
//            移入
        },function(){
            $(this).hide()
        });
        </script>
    </body>
</html>